home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1989 …il & Dave's Excellent CD / Excellent CD HFS.raw / Moof / Goodies / MPW Goodies / Interfaces / PInterfaces / Palettes.p < prev    next >
Encoding:
Text File  |  1988-11-30  |  3.8 KB  |  118 lines  |  [TEXT/MPS ]

  1. {
  2. Created: Tuesday, August 2, 1988 at 8:45 AM
  3.     Palettes.p
  4.     Pascal Interface to the Macintosh Libraries
  5.  
  6.     Copyright Apple Computer, Inc.  1987-1988
  7.     All rights reserved
  8. }
  9.  
  10.  
  11. {$IFC UNDEFINED UsingIncludes}
  12. {$SETC UsingIncludes := 0}
  13. {$ENDC}
  14.  
  15. {$IFC NOT UsingIncludes}
  16.     UNIT Palettes;
  17.     INTERFACE
  18. {$ENDC}
  19.  
  20. {$IFC UNDEFINED UsingPalettes}
  21. {$SETC UsingPalettes := 1}
  22.  
  23. {$I+}
  24. {$SETC PalettesIncludes := UsingIncludes}
  25. {$SETC UsingIncludes := 1}
  26. {$IFC UNDEFINED UsingQuickdraw}
  27. {$I $$Shell(PInterfaces)Quickdraw.p}
  28. {$ENDC}
  29. {$IFC UNDEFINED UsingWindows}
  30. {$I $$Shell(PInterfaces)Windows.p}
  31. {$ENDC}
  32. {$SETC UsingIncludes := PalettesIncludes}
  33.  
  34. CONST
  35. pmCourteous = 0;                            {Record use of color on each device touched.}
  36. pmTolerant = 2;                             {render ciRGB if ciTolerance is exceeded by best match.}
  37. pmAnimated = 4;                             {reserve an index on each device touched and render ciRGB.}
  38. pmExplicit = 8;                             {no reserve, no render, no record; stuff index into port.}
  39.  
  40. { NSetPalette Update Constants }
  41.  
  42. pmNoUpdates = $8000;                        {no updates}
  43. pmBkUpdates = $A000;                        {background updates only}
  44. pmFgUpdates = $C000;                        {foreground updates only}
  45. pmAllUpdates = $E000;                       {all updates}
  46.  
  47.  
  48. TYPE
  49.  
  50. ColorInfo = RECORD
  51.     ciRGB: RGBColor;                        {true RGB values}
  52.     ciUsage: INTEGER;                       {color usage}
  53.     ciTolerance: INTEGER;                   {tolerance value}
  54.     ciDataFields: ARRAY [0..2] OF INTEGER;  {private fields}
  55.     END;
  56.  
  57. PalettePtr = ^Palette;
  58. PaletteHandle = ^PalettePtr;
  59. Palette = RECORD
  60.     pmEntries: INTEGER;                     {entries in pmTable}
  61.     pmDataFields: ARRAY [0..6] OF INTEGER;  {private fields}
  62.     pmInfo: ARRAY [0..0] OF ColorInfo;
  63.     END;
  64.  
  65.  
  66.  
  67. PROCEDURE InitPalettes;
  68.     INLINE $AA90;
  69. FUNCTION NewPalette(entries: INTEGER;srcColors: CTabHandle;srcUsage: INTEGER;
  70.     srcTolerance: INTEGER): PaletteHandle;
  71.     INLINE $AA91;
  72. FUNCTION GetNewPalette(PaletteID: INTEGER): PaletteHandle;
  73.     INLINE $AA92;
  74. PROCEDURE DisposePalette(srcPalette: PaletteHandle);
  75.     INLINE $AA93;
  76. PROCEDURE ActivatePalette(srcWindow: WindowPtr);
  77.     INLINE $AA94;
  78. PROCEDURE SetPalette(dstWindow: WindowPtr;srcPalette: PaletteHandle;cUpdates: BOOLEAN);
  79.     INLINE $AA95;
  80. PROCEDURE NSetPalette(dstWindow: WindowPtr;srcPalette: PaletteHandle;nCUpdates: INTEGER);
  81.     INLINE $AA95;
  82. FUNCTION GetPalette(srcWindow: WindowPtr): PaletteHandle;
  83.     INLINE $AA96;
  84. PROCEDURE CopyPalette(srcPalette: PaletteHandle;dstPalette: PaletteHandle;
  85.     srcEntry: INTEGER;dstEntry: INTEGER;dstLength: INTEGER);
  86.     INLINE $AAA1;
  87. PROCEDURE PmForeColor(dstEntry: INTEGER);
  88.     INLINE $AA97;
  89. PROCEDURE PmBackColor(dstEntry: INTEGER);
  90.     INLINE $AA98;
  91. PROCEDURE AnimateEntry(dstWindow: WindowPtr;dstEntry: INTEGER;srcRGB: RGBColor);
  92.     INLINE $AA99;
  93. PROCEDURE AnimatePalette(dstWindow: WindowPtr;srcCTab: CTabHandle;srcIndex: INTEGER;
  94.     dstEntry: INTEGER;dstLength: INTEGER);
  95.     INLINE $AA9A;
  96. PROCEDURE GetEntryColor(srcPalette: PaletteHandle;srcEntry: INTEGER;VAR dstRGB: RGBColor);
  97.     INLINE $AA9B;
  98. PROCEDURE SetEntryColor(dstPalette: PaletteHandle;dstEntry: INTEGER;srcRGB: RGBColor);
  99.     INLINE $AA9C;
  100. PROCEDURE GetEntryUsage(srcPalette: PaletteHandle;srcEntry: INTEGER;VAR dstUsage: INTEGER;
  101.     VAR dstTolerance: INTEGER);
  102.     INLINE $AA9D;
  103. PROCEDURE SetEntryUsage(dstPalette: PaletteHandle;dstEntry: INTEGER;srcUsage: INTEGER;
  104.     srcTolerance: INTEGER);
  105.     INLINE $AA9E;
  106. PROCEDURE CTab2Palette(srcCTab: CTabHandle;dstPalette: PaletteHandle;srcUsage: INTEGER;
  107.     srcTolerance: INTEGER);
  108.     INLINE $AA9F;
  109. PROCEDURE Palette2CTab(srcPalette: PaletteHandle;dstCTab: CTabHandle);
  110.     INLINE $AAA0;
  111.  
  112. {$ENDC}    { UsingPalettes }
  113.  
  114. {$IFC NOT UsingIncludes}
  115.     END.
  116. {$ENDC}
  117.  
  118.